package guoanmaker.operator.helper.common.util;

import java.security.MessageDigest;

public class MD5 {

	public static String md5(String str) {
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(str.getBytes("UTF-8"));
			byte b[] = md.digest();

			int i;

			StringBuffer buf = new StringBuffer("");
			for (int offset = 0; offset < b.length; offset++) {
				i = b[offset];
				if (i < 0)
					i += 256;
				if (i < 16)
					buf.append("0");
				buf.append(Integer.toHexString(i));
			}
			str = buf.toString();
		} catch (Exception e) {
			e.printStackTrace();

		}
		return str;
	}
	
/*	public static String md5(String str) {
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(str.getBytes("gbk"));
			byte b[] = md.digest();

			int i;

			StringBuffer buf = new StringBuffer("");
			for (int offset = 0; offset < b.length; offset++) {
				i = b[offset];
				if (i < 0)
					i += 256;
				if (i < 16)
					buf.append("0");
				buf.append(Integer.toHexString(i));
			}
			str = buf.toString();
		} catch (Exception e) {
			e.printStackTrace();

		}
		return str;
	}*/
 
	public static void main(String[] args) {
		//System.out.println(md5("31119@qq.com"+"123456"));
		//System.out.println(md5("mj1"));
		//System.out.println(md5("mashituone").toUpperCase());
		
		System.out.println(md5("appid=wxdbbef6e38c3a075f&body=定金&mch_id=1338834201&nonce_str=3juXtmh6xcSa65Rr3Z6vGcujqJHrst7V&notify_url=http://www.artguru.cn/weChatPayNotify.htmls&out_trade_no=04261645391751000620170413004&spbill_create_ip=127.0.0.1&total_fee=1&trade_type=NATIVE&key=bayshoresvsvsvsvvsdvvxb422411222"));
	
/*		   JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); 
  		  Client client = factory.createClient("http://122.49.7.199:8080/BOSS/services/outsideService/outsideService?wsdl"); 
  		//String host = configInfo.getHost();  
  		String re="<?xml version='1.0' encoding='UTF-8'?><orderInfo><accountId>9</accountId><accountName>test1</accountName><orderNumber>20160315</orderNumber>"+
  				"<task-1><count>10000</count></task-1><task-2><count>10000</count></task-2><task-3><count>5000</count></task-3>"+
  				"<task-4><model>B+,C4,C5</model><count>10,10,30</count><days>180,180,180</days></task-4>"+
  				"<task-5><identifiers>XXXXXXXXXX,XXXXXXXXXX</identifiers><days>180</days></task-5>"+
  				"<task-6><days>180</days></task-6></orderInfo>";
      		try { 
      			//Object[] obj = client.invoke("orderApply", re,"745C2EFCA4A842F67C3464C5DD5869BA"); 
      			//Object[] test=new Object[]{"9","866693025161521","huawei","mate8","2CC4935F5E6A7AD66D8E41F34F9C390E"};
      			//Object[] test=new Object[]{"9","1714225","1","1000","64047D4F491956F5F5B77921D2E5D9EE"};
      			Object[] test=new Object[]{"4","18910136310","测试短信","2CC4935F5E6A7AD66D8E41F34F9C390E"};
      			Object[] obj = client.invoke("sendMessage", test);  
      			String resule = obj[0].toString();
      			//**resule = {"status":true,"msg":"牌照初始化租用天数成�?"}**//*
      			System.out.println(resule);
      			
      		} catch (Exception e) { 
      			e.printStackTrace(); 
      		} */ 
		 
	}
}
